/****************************************************************************
**
** SkillGroupManager.h
**
** Copyright (C) August 2014 Hotride
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
*****************************************************************************
*/
//---------------------------------------------------------------------------
#ifndef SkillGroupManagerH
#define SkillGroupManagerH
//---------------------------------------------------------------------------
class TSkillGroupObject
{
private:
	BYTE m_Items[60];
	int m_Count;
	bool m_Maximized;
	BYTE m_Selected;

	string m_Name;
	TEXT_TEXTURE_HEADER m_Texture;

public:
	TSkillGroupObject *m_Next;
	TSkillGroupObject *m_Prev;

	TSkillGroupObject();
	~TSkillGroupObject();

	SETGET(int, Count)
	SETGET(bool, Maximized)
	SETGET(BYTE, Selected)

	void SetName(string val);
	string GetName() const {return m_Name;}

	TEXT_TEXTURE_HEADER GetTexture() const {return m_Texture;}

	BYTE GetItem(int index);
	
	void Add(BYTE index);
	void AddSorted(BYTE index);
	void Remove(BYTE index);
	bool Contains(BYTE index);
	void Sort();
	void TransferTo(TSkillGroupObject *group);
};
//---------------------------------------------------------------------------
class TSkillGroupManager
{
private:
	int m_Count;

	void MakeDefaultMiscellaneous();
	void MakeDefaultCombat();
	void MakeDefaultTradeSkills();
	void MakeDefaultMagic();
	void MakeDefaultWilderness();
	void MakeDefaultThieving();
	void MakeDefaultBard();

public:
	TSkillGroupObject *m_Groups;

	TSkillGroupManager();
	~TSkillGroupManager();

	SETGET(int, Count)

	void MakeDefault();
	void Clear();
	void Add(TSkillGroupObject *group);
	void Remove(TSkillGroupObject *group);

	int GetVisibleLinesCount();
	
	int Load(FILE *file);
	void Save(FILE *file);
};
//---------------------------------------------------------------------------
#endif